# import pytesseract
# from PIL import Image
#
# # 打开图片
# img = Image.open(r'E:\auto\PythonProject1\testimage\a1.png')
# # 使用Tesseract进行文字识别
# text = pytesseract.image_to_string(img,lang='chi_sim')
# print('print--->',text)

import cv2
from paddleocr import PaddleOCR

if __name__ == '__main__':
    ocr = PaddleOCR(use_angle_cls=True, lang="ch", ocr_version='PP-OCRv4')
    image_input_fullname = r'E:\auto\PythonProject1\testimage\a1.png'
    img = cv2.imread(image_input_fullname)
    result = ocr.ocr(img, cls=True)
    print('result',result)

#
# import paddleocr
#
# # e:\Program Files\Tesseract-OCR
#
# # 创建一个OCR识别器
# ocr = paddleocr.ocr()
# # 读取图片
# img_path = r'E:\auto\PythonProject1\testimage\a1.png'
# img = paddleocr.read_image(img_path)
# # 进行文字识别
# result = ocr.ocr(img)
# # 显示识别结果
# for line in result:
#     print(' '.join((word_info[-1] for word_info in line)))


import easyocr

# def initReader():
#     reader = easyocr.Reader(['ch_sim', 'en'], gpu=False)  # this needs to run only once to load the model into memory
#     return reader



def orcimage(img):
    # reader = easyocr.Reader(['ch_sim','en'], gpu=False)
    # result = reader.readtext(r'E:\auto\PythonProject1\testimage\a1.png',detail = 0)
    reader = easyocr.Reader(['ch_sim', 'en'], gpu=False)  # this needs to run only once to load the model into memory
    result = reader.readtext(img, detail=0)
    print('orcinage result--->',result)
    return  result